//
//  BQTypeCell.m
//  BeeQuick
//
//  Created by Vivitickey on 2017/4/26.
//  Copyright © 2017年 test. All rights reserved.
//

#import "BQTypeCell.h"
#import "BQHomeModel.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>
@interface BQTypeCell ()

@property (weak, nonatomic) UIImageView *iconImageView;
@property (weak, nonatomic) UILabel *typeNameLabel;


@end

@implementation BQTypeCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    
    return self;
}

-(void)setupUI{
    
    UIImageView *iconImageView = [[UIImageView alloc] init];
    
    _iconImageView = iconImageView;

    [self.contentView addSubview:iconImageView];
    
    UILabel *typeNameLabel = [[UILabel alloc]init];
    
    _typeNameLabel = typeNameLabel;
    
    [self.contentView addSubview:typeNameLabel];
    
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        
        make.top.offset(10);
        
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(60);
    }];
    
    [typeNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(iconImageView);
        
        make.top.equalTo(iconImageView.mas_bottom).offset(5);
    }];
    
    
}

-(void)setModel:(BQHomeModel *)model{
    
    _model = model;
    
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.img]];
    self.typeNameLabel.text = model.name;
    
}


@end
